// import { pageList } from './comInstance'
// import { DBNames } from '@/enum/dbName'
import { request } from './request'

const api = {
  findCpyListByName: '/policy/findCpyListByName',
  findPolicyByCpyInfo: '/policy/findPolicyByCpyInfo',
  findPolicyByPage: '/policy/findPolicyByPage',
}

interface IPolicyListParams {
  area: string
  attributes?: string
  dept?: string
  industries?: string
  pageIndex: number
  pageSize: number
  searchKey?: string
}

export const getPolicyPageList = (params: IPolicyListParams) => {
  // @ts-ignore
  const defaultParams = {
    area: 'RegisterArea_ZXS_Chongqing',
    pageIndex: 1,
    pageSize: 10,
  }
  return request.post(api.findPolicyByPage, { ...defaultParams, ...params })
}

export const getCpyListByName = (name: string) => {
  return request.get(api.findCpyListByName, { params: { name } })
}

interface IPolicyListByCpyInfoParams {
  areaCode: string
  industries: string
  name: string
}

export const getPolicyByCpyInfo = (params: IPolicyListByCpyInfoParams) => {
  const defaultParams = {
    areaCode: 'RegisterArea_ZXS_Chongqing',
    // industries: '汽车制造业',
    // name: '苏州园查查数据技术有限公司',
  }

  return request.post(api.findPolicyByCpyInfo, { ...defaultParams, ...params })
}
